<?php  /* 作用：查询并返回数据库数据 */		
// 从数据库获取数据
$conn=mysqli_connect('localhost','root','root','2008'); 
mysqli_query($conn,"set charset 'utf8'");	
mysqli_query($conn,"set character set 'utf8'");

// sql语句
$sql='select * from users order by id';	
// 得到查询结果s                    
$res=mysqli_query($conn,$sql);
// 转换到数组
$list=array();
while($row=mysqli_fetch_assoc($res)){
	array_push($list,$row);
}
// 返回json数据
echo json_encode(array(
	"code"=>200,
	"body"=>array(
	"list"=>$list
	)
))								

?>